﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/admincp.Master" AutoEventWireup="true" CodeBehind="Article.aspx.cs" Inherits="VINETLIFE.AdminCP.Article" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
    function SelectAndClosePopup(value) {
        cbCategory.SetValue(value);
        pcParent.Hide();
    }
</script>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function OnClientPasteHtml(sender, args) {
            var commandName = args.get_commandName();
            var value = args.get_value();
            if (commandName == "ImageManager") {
                //See if an img has an alt tag set
                var div = document.createElement("DIV");
                //Do not use div.innerHTML as in IE this would cause the image's src or the link's href to be converted to absolute path.
                //This is a severe IE quirk.
                Telerik.Web.UI.Editor.Utils.setElementInnerHtml(div, value);
                //Now check if there is alt attribute
                var img = div.firstChild;
                //alert(div.innerHTML);

                //Set new content to be pasted into the editor

                if (!!img.alt) {
                    var newInner = "<center>";
                    newInner = newInner + "<img src='" + img.src + "' alt='" + img.alt + "'/></center><center>";
                    newInner = newInner + img.alt + "</center>";

                    args.set_value(newInner);
                }
                else {
                    var newInner = "<center><img src='" + img.src + "' alt='Vinetlife'/></center><br/>";

                    args.set_value(newInner);
                }

            }
        }
    </script>
</telerik:RadCodeBlock>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>
    Cập nhật Tin tức</h2>
<table class="tablet">
    <tr>
        <td class="style8" style="width: 150px;">
            Tiêu đề:
        </td>
        <td class="style9" colspan="3">
            <asp:TextBox ID="txtTitle" runat="server" Width="350px" ValidationGroup="submitGrp"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtTitle"
                ErrorMessage="*** Cần nhập tiêu đề" ValidationGroup="submitGrp"></asp:RequiredFieldValidator>
            <asp:CheckBox ID="chkVote" Text="Cho Đánh giá" runat="server" Visible="false" />
            &nbsp;<asp:CheckBox ID="chkComment" Text="Cho Bình luận" runat="server" Visible="false" />
        </td>
    </tr>
    <tr>
        <td>
            Danh mục:
        </td>
        <td>
            <asp:DropDownList ID="cboCategoryCate" runat="server" AppendDataBoundItems="true" CssClass="ddl-input" Width="250px">
                <asp:ListItem Value="0" Text=".: Chọn danh mục :."></asp:ListItem>
            </asp:DropDownList>
        </td>
        <td style="display: none;">
            Parent Article:
        </td>
        <td style="display: none;">
            <asp:DropDownList Visible="false" ID="ddlArticle" runat="server">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td>
            Ảnh đại diện
        </td>
        <td>
            <asp:FileUpload ID="fuImage" runat="server" />
            &nbsp; &nbsp; &nbsp;
            <asp:HyperLink ID="hplImage" runat="server" Target="_blank" Visible="False">[Xem 
            ảnh]</asp:HyperLink>
        </td>
    </tr>
    <tr>
        <td class="style8">
            Mô tả:
        </td>
        <td colspan="3">
            <asp:TextBox ID="txtDescription" runat="server" Height="102px" TextMode="MultiLine"
                Width="90%"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td class="style8">
            Chi tiết:
        </td>
        <td colspan="3">
            <CKEditor:CKEditorControl ID="txtArticleDetail" runat="server" Width="90%" Visible="false">
            </CKEditor:CKEditorControl>
            <telerik:RadEditor ID="txtDetail" runat="server" OnClientPasteHtml="OnClientPasteHtml"
                DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd" Width="99%" Height="700px">
                <ImageManager MaxUploadFileSize="1024000000"></ImageManager>
            </telerik:RadEditor>
        </td>
    </tr>
    <tr>
            <td class="style8">
                MetaDes:<br />
                Độ dài: 70~160 ký tự
            </td>
            <td>
                <asp:TextBox ID="txtMetaDes" runat="server" Width="100%" ValidationGroup="submitGrp"
                    Height="60px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                MetaTag: <br />  
                Lưu ý: các Tag phải cách nhau bằng dấu phẩy vd: xe đap, xe đap gấp, xe đạp điện      
            </td>
            <td>
                <asp:TextBox ID="txtMetaTag" runat="server" Width="100%" ValidationGroup="submitGrp"
                    Height="60px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                PageTitle:
                <br />
                Độ dài: 10~70 ký tự
            </td>
            <td>
                <asp:TextBox ID="txtPageTitle" runat="server" Width="100%" ValidationGroup="submitGrp"
                    Height="60px" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
    <tr>
        <td class="style8">
            Hiển thị:
        </td>
        <td class="style4" colspan="3">
            <div style="float: left; vertical-align: middle;">
                &nbsp;
                <asp:CheckBox ID="chkIsHomePage" runat="server"  />
                Hiện ở trang chủ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:CheckBox ID="chkIsPublish" runat="server" Visible="false" />
                <%-- Ẩn đi--%>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Số thứ tự:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
            <div style="float: left; vertical-align: middle;">
                <asp:TextBox ID="txtOrderID" runat="server" Width="68px" Text="0" ValidationGroup="submitGrp"></asp:TextBox>
            </div>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtOrderID"
                ErrorMessage="*** Cần nhập số thứ tự" ValidationGroup="submitGrp"></asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Nhập số(Giá trị từ 0~1000)"
                ForeColor="Red" ControlToValidate="txtOrderID" Type="Integer" MinimumValue="0"
                MaximumValue="1000"></asp:RangeValidator>
        </td>
    </tr>
    <tr>
        <td class="style8">
            &nbsp;
        </td>
        <td class="style4" colspan="3">
            <asp:Button CssClass="button-gg-green" ID="btnSave" runat="server" Text="Lưu" OnClick="btnSave_Click" ValidationGroup="submitGrp" />
            <asp:Button CssClass="button-gg-green" ID="btnReset" runat="server" Text="Hủy" 
                onclick="btnReset_Click" />
        </td>
    </tr>
</table>
</asp:Content>
